﻿<UserControl x:Class="Tum.PDE.ToolFramework.Modeling.Visualization.Base.Controls.WelcomeWindowControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:attached="clr-namespace:Tum.PDE.ToolFramework.Modeling.Visualization.Base.Controls.Attached"
             xmlns:conv="clr-namespace:Tum.PDE.ToolFramework.Modeling.Visualization.Base.Converters"
             mc:Ignorable="d" 
             d:DesignHeight="400" d:DesignWidth="1000" 
            TextOptions.TextFormattingMode="Display" >
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Tum.PDE.ToolFramework.Modeling.Visualization.Base;component/Themes/Default/LinkItemsStyle.xaml"/>
                <ResourceDictionary Source="/Tum.PDE.ToolFramework.Modeling.Visualization.Base;component/Themes/Default/NoMouseOverButtonStyle.xaml"/>
            </ResourceDictionary.MergedDictionaries>

            <conv:BoolToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>

            <SolidColorBrush x:Key="RibbonTopBorderBrush" Color="#FF5E5E5E"/>
            <LinearGradientBrush x:Key="DockablePaneTitleBackground" StartPoint="0,0" EndPoint="0,1">
                <GradientStop Color="#FFB7CAE0" Offset="0" />
                <GradientStop Color="#FFE8F0FF" Offset="1" />
            </LinearGradientBrush>
        </ResourceDictionary>
     

    </UserControl.Resources>
    <Grid>
        <Grid.Background>
            <LinearGradientBrush
                         StartPoint="0,0"
                         EndPoint="0,1">
                <LinearGradientBrush.GradientStops>
                    <GradientStop Color="#FFECF5FC" Offset="0.4" />
                    <GradientStop Color="#FF98B4D2" Offset="1" />
                </LinearGradientBrush.GradientStops>
            </LinearGradientBrush>
        </Grid.Background>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Border x:Name="PART_Header" Focusable="False"
							        BorderThickness="1,1,1,0" Background="{StaticResource DockablePaneTitleBackground}"
							        BorderBrush="DarkGray"
                                    Height="18" Grid.Row="0">
            <TextBlock Text="Welcome"      Margin="2,0,0,0" TextTrimming="CharacterEllipsis" TextWrapping="NoWrap"
                                            VerticalAlignment="Center" />
        </Border>
        <ScrollViewer Grid.Row="1" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>

                <Grid Grid.Column="0">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="*"/>
                    </Grid.RowDefinitions>

                    <StackPanel Margin="15, 10, 0, 0" Width="500" HorizontalAlignment="Left" >
                        <!-- Recent Documents TextBlock -->
                        <Grid Margin="0,0,10,0">
                            <TextBlock Margin="0,5" TextWrapping="Wrap" Text="Common Actions" VerticalAlignment="Center" FontSize="14" FontWeight="Bold" Foreground="#FF5E5E5E"/>
                            <Path Data="M0,0L1,0" Fill="{x:Null}" Height="1" Margin="0" StrokeStartLineCap="Flat" Stretch="Fill" StrokeEndLineCap="Flat" Stroke="{StaticResource RibbonTopBorderBrush}" StrokeThickness="1" StrokeMiterLimit="10" StrokeLineJoin="Miter" VerticalAlignment="Bottom" StrokeDashArray="2 2"/>
                        </Grid>

                        <Button Margin="5,0,5,0" Background="Transparent" BorderBrush="Transparent" BorderThickness="0" Command="{Binding Path=NewModelCommand}" HorizontalAlignment="Left" Focusable="False">
                            <StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
                                <Image Source="/Tum.PDE.ToolFramework.Images;component/Ribbon/New-32.png" Width="32" Height="32"></Image>
                                <TextBlock Text="New Model" VerticalAlignment="Center" Margin="5"/>
                            </StackPanel>
                        </Button>

                        <Button Margin="5" Background="Transparent" BorderBrush="Transparent" BorderThickness="0" Command="{Binding Path=OpenModelCommand}" HorizontalAlignment="Left" Focusable="False">
                            <StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
                                <Image Source="/Tum.PDE.ToolFramework.Images;component/Ribbon/Open-32.png" Width="32" Height="32"></Image>
                                <TextBlock Text="Open Model ..." VerticalAlignment="Center" Margin="5"/>
                            </StackPanel>
                        </Button>

                    </StackPanel>

                    <StackPanel Margin="15, 10, 0, 0" Orientation="Vertical" Width="500" HorizontalAlignment="Left" Grid.Row="1">

                        <!-- Recent Documents TextBlock -->
                        <Grid Margin="0,0,10,0">
                            <TextBlock Margin="0,5" TextWrapping="Wrap" Text="Recent Documents" VerticalAlignment="Center" FontSize="14" FontWeight="Bold" Foreground="#FF5E5E5E"/>
                            <Path Data="M0,0L1,0" Fill="{x:Null}" Height="1" Margin="0" StrokeStartLineCap="Flat" Stretch="Fill" StrokeEndLineCap="Flat" Stroke="{StaticResource RibbonTopBorderBrush}" StrokeThickness="1" StrokeMiterLimit="10" StrokeLineJoin="Miter" VerticalAlignment="Bottom" StrokeDashArray="2 2"/>
                        </Grid>

                        <!-- ListBox -->
                        <ListBox x:Name="lstBoxMRUEntries" Width="500" Margin="0, 10, 0, 0" BorderThickness="0" BorderBrush="Transparent" DataContext="{Binding Path=MRUFilesViewModel, Mode=OneWay}"
                                            ItemsSource="{Binding Path=MRUFileEntries, Mode=OneWay}"
                                            SelectedItem="{Binding Path=SelectedMRUFileEntry, Mode=TwoWay}"
                                  Background="Transparent">
                            <ListBox.ItemTemplate>
                                <DataTemplate>
                                    <Grid>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="48"/>
                                            <ColumnDefinition Width="370"/>
                                            <ColumnDefinition Width="22"/>
                                            <ColumnDefinition Width="22"/>
                                        </Grid.ColumnDefinitions>

                                        <Image Source="/Tum.PDE.ToolFramework.Images;component/Ribbon/RecentItem-32.png" Width="32" Height="32" Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                                        <StackPanel Orientation="Vertical" Grid.Column="1">
                                            <TextBlock Text="{Binding Path=ShortName, Mode=OneWay}" TextTrimming="CharacterEllipsis"/>
                                            <TextBlock Text="{Binding Path=FileName, Mode=OneWay}" TextTrimming="CharacterEllipsis" ToolTip="{Binding Path=FileName, Mode=OneWay}"/>
                                        </StackPanel>

                                        <Button Width="18" Grid.Column="2" HorizontalAlignment="Center" VerticalAlignment="Center" Focusable="False" 
                                                BorderBrush="Transparent" BorderThickness="0" Background="Transparent" Padding="0"
                                                Command="{Binding Path=DataContext.MoveToTopCommand, ElementName=lstBoxMRUEntries}"
                                                CommandParameter="{Binding Path=MRUFileEntry}">
                                            <Image Source="/Tum.PDE.ToolFramework.Images;component/Ribbon/Up-16.png"/>
                                        </Button>
                                        <Button Width="18" Grid.Column="3" HorizontalAlignment="Center" VerticalAlignment="Center" Focusable="False" 
                                                BorderBrush="Transparent" BorderThickness="0" Background="Transparent" Padding="0"
                                                Command="{Binding Path=DataContext.RemoveCommand, ElementName=lstBoxMRUEntries}"
                                                CommandParameter="{Binding Path=MRUFileEntry}">
                                            <Image Source="/Tum.PDE.ToolFramework.Images;component/Ribbon/Delete-16.png"/>
                                        </Button>
                                    </Grid>
                                </DataTemplate>
                            </ListBox.ItemTemplate>

                            <ListBox.ItemContainerStyle>
                                <Style TargetType="{x:Type ListBoxItem}">
                                    <Setter Property="attached:CommandBehavior.Event" Value="MouseDoubleClick" />
                                    <Setter Property="attached:CommandBehavior.Command" Value="{Binding ElementName=lstBoxMRUEntries, Path=DataContext.OpenCommand}" />
                                    <Setter Property="attached:CommandBehavior.CommandParameter" Value="{Binding ElementName=lstBoxMRUEntries, Path=DataContext.SelectedMRUFileEntry.MRUFileEntry}" />
                                    <Setter Property="Template">
                                        <Setter.Value>
                                            <ControlTemplate TargetType="{x:Type ListBoxItem}">
                                                <Grid Margin="0,3">
                                                    <Border x:Name="border" BorderThickness="1" Margin="0" CornerRadius="3" Background="Transparent">
                                                        <Border x:Name="border1" BorderThickness="1" CornerRadius="2"  Background="Transparent">
                                                            <ContentPresenter Margin="5,5,15,5"/>
                                                        </Border>
                                                    </Border>
                                                </Grid>
                                                <ControlTemplate.Triggers>
                                                    <Trigger Property="Selector.IsSelected" Value="True">
                                                        <Setter Property="Background" TargetName="border" Value="{DynamicResource ButtonPressedOuterBackgroundBrush}"/>
                                                        <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource ButtonPressedOuterBorderBrush}"/>
                                                        <Setter Property="BorderBrush" TargetName="border1" Value="{DynamicResource ButtonPressedInnerBorderBrush}"/>
                                                        <Setter Property="Background" TargetName="border1" Value="{DynamicResource ButtonPressedInnerBackgroundBrush}"/>
                                                    </Trigger>
                                                    <MultiTrigger>
                                                        <MultiTrigger.Conditions>
                                                            <Condition Property="IsMouseOver" Value="True"/>
                                                            <Condition Property="Selector.IsSelected" Value="False"/>
                                                        </MultiTrigger.Conditions>
                                                        <Setter Property="Background" TargetName="border" Value="{DynamicResource ButtonHoverOuterBackgroundBrush}"/>
                                                        <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource ButtonHoverOuterBorderBrush}"/>
                                                        <Setter Property="BorderBrush" TargetName="border1" Value="{DynamicResource ButtonHoverInnerBorderBrush}"/>
                                                        <Setter Property="Background" TargetName="border1" Value="{DynamicResource ButtonHoverInnerBackgroundBrush}"/>
                                                    </MultiTrigger>
                                                </ControlTemplate.Triggers>
                                            </ControlTemplate>
                                        </Setter.Value>
                                    </Setter>
                                </Style>
                            </ListBox.ItemContainerStyle>
                        </ListBox>
                    </StackPanel>
                </Grid>

                <Grid Grid.Column="1">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="*"/>
                    </Grid.RowDefinitions>

                    <StackPanel Margin="15, 10, 0, 0" Orientation="Vertical" Width="500" HorizontalAlignment="Left" Grid.Row="0">
                        <!-- Further Information TextBlock -->
                        <Grid Margin="0,0,10,0">
                            <TextBlock Margin="0,5" TextWrapping="Wrap" Text="Further Information" VerticalAlignment="Center" FontSize="14" FontWeight="Bold" Foreground="#FF5E5E5E"/>
                            <Path Data="M0,0L1,0" Fill="{x:Null}" Height="1" Margin="0" StrokeStartLineCap="Flat" Stretch="Fill" StrokeEndLineCap="Flat" Stroke="{DynamicResource RibbonTopBorderBrush}" StrokeThickness="1" StrokeMiterLimit="10" StrokeLineJoin="Miter" VerticalAlignment="Bottom" StrokeDashArray="2 2"/>
                        </Grid>

                        <!-- Uncategorized items -->
                        <ListBox Width="500" Margin="0, 10, 0, 0" BorderThickness="0" BorderBrush="Transparent"
                                            ItemsSource="{Binding Path=FurtherReadingViewModel.LinkItemVMsWithoutCategory, Mode=OneWay}"
                                            ItemTemplate="{StaticResource LinkItemUncategorizedTemplate}"  Background="Transparent"
                                            ItemContainerStyle="{StaticResource BackstageListBoxItemNoSelection}"
                                            Visibility="{Binding Path=FurtherReadingViewModel.HasLinkItemVMsWithoutCategory, Mode=OneWay, Converter={StaticResource BooleanToVisibilityConverter}}">
                        </ListBox>

                        <!-- Categorized items -->
                        <ItemsControl Width="500" Margin="0, 10, 0, 0" BorderThickness="0" BorderBrush="Transparent" Focusable="False"
                                            ItemsSource="{Binding Path=FurtherReadingViewModel.LinkItemVmsCategorized, Mode=OneWay}"
                                            ItemTemplate="{StaticResource LinkItemsCategorizedTemplate}"  Background="Transparent"
                                            Visibility="{Binding Path=FurtherReadingViewModel.HasLinkItemVmsCategorized, Mode=OneWay, Converter={StaticResource BooleanToVisibilityConverter}}">
                        </ItemsControl>
                    </StackPanel>
                </Grid>
            </Grid>
        </ScrollViewer>
    </Grid>
</UserControl>
